

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>ultra.ranking_model package &mdash; ULTRA 0.2beta documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="_static/language_data.js"></script>
        <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="ultra.utils package" href="ultra.utils.html" />
    <link rel="prev" title="ultra.learning_algorithm package" href="ultra.learning_algorithm.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> ULTRA
          

          
          </a>

          
            
            
              <div class="version">
                0.2
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">ultra</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="ultra.html">ultra package</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="ultra.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="ultra.input_layer.html">ultra.input_layer package</a></li>
<li class="toctree-l4"><a class="reference internal" href="ultra.learning_algorithm.html">ultra.learning_algorithm package</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">ultra.ranking_model package</a></li>
<li class="toctree-l4"><a class="reference internal" href="ultra.utils.html">ultra.utils package</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="ultra.html#module-ultra">Module contents</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="input_layer_reference.html">Input Layer Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="learning_algorithm_reference.html">Learning Algorithm Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="ranking_model_reference.html">Ranking Model Reference</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">ULTRA</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
          <li><a href="modules.html">ultra</a> &raquo;</li>
        
          <li><a href="ultra.html">ultra package</a> &raquo;</li>
        
      <li>ultra.ranking_model package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/ultra.ranking_model.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  
<style>
/* CSS overrides for sphinx_rtd_theme */

/* 24px margin */
.nbinput.nblast.container,
.nboutput.nblast.container {
    margin-bottom: 19px;  /* padding has already 5px */
}

/* ... except between code cells! */
.nblast.container + .nbinput.container {
    margin-top: -19px;
}

.admonition > p:before {
    margin-right: 4px;  /* make room for the exclamation icon */
}

/* Fix math alignment, see https://github.com/rtfd/sphinx_rtd_theme/pull/686 */
.math {
    text-align: unset;
}
</style>
<div class="section" id="ultra-ranking-model-package">
<h1>ultra.ranking_model package<a class="headerlink" href="#ultra-ranking-model-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-ultra.ranking_model.base_ranking_model">
<span id="ultra-ranking-model-base-ranking-model-module"></span><h2>ultra.ranking_model.base_ranking_model module<a class="headerlink" href="#module-ultra.ranking_model.base_ranking_model" title="Permalink to this headline">¶</a></h2>
<p>The basic class that contains all the API needed for the implementation of a ranking model.</p>
<dl class="class">
<dt id="ultra.ranking_model.base_ranking_model.ActivationFunctions">
<em class="property">class </em><code class="sig-prename descclassname">ultra.ranking_model.base_ranking_model.</code><code class="sig-name descname">ActivationFunctions</code><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.ActivationFunctions" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Activation Functions key strings.</p>
<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.ActivationFunctions.ELU">
<code class="sig-name descname">ELU</code><em class="property"> = 'elu'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.ActivationFunctions.ELU" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.ActivationFunctions.RELU">
<code class="sig-name descname">RELU</code><em class="property"> = 'relu'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.ActivationFunctions.RELU" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.ActivationFunctions.SELU">
<code class="sig-name descname">SELU</code><em class="property"> = 'selu'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.ActivationFunctions.SELU" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.ActivationFunctions.SIGMOID">
<code class="sig-name descname">SIGMOID</code><em class="property"> = 'sigmoid'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.ActivationFunctions.SIGMOID" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.ActivationFunctions.TANH">
<code class="sig-name descname">TANH</code><em class="property"> = 'tanh'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.ActivationFunctions.TANH" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel">
<em class="property">class </em><code class="sig-prename descclassname">ultra.ranking_model.base_ranking_model.</code><code class="sig-name descname">BaseRankingModel</code><span class="sig-paren">(</span><em class="sig-param">hparams_str=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABC</span></code></p>
<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel.ACT_FUNC_DIC">
<code class="sig-name descname">ACT_FUNC_DIC</code><em class="property"> = {'elu': &lt;function elu&gt;, 'relu': &lt;function relu&gt;, 'selu': &lt;function selu&gt;, 'sigmoid': &lt;function sigmoid&gt;, 'tanh': &lt;function tanh&gt;}</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel.ACT_FUNC_DIC" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel.INITIALIZER_DIC">
<code class="sig-name descname">INITIALIZER_DIC</code><em class="property"> = {'constant': &lt;tensorflow.python.ops.init_ops.Constant object&gt;}</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel.INITIALIZER_DIC" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel.NORM_FUNC_DIC">
<code class="sig-name descname">NORM_FUNC_DIC</code><em class="property"> = {'batch': &lt;class 'tensorflow.python.keras.layers.normalization.BatchNormalization'&gt;, 'layer': &lt;class 'tensorflow.python.keras.layers.normalization.LayerNormalization'&gt;}</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel.NORM_FUNC_DIC" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel.__init__">
<em class="property">abstract </em><code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">hparams_str=None</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create the network.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>hparams_str</strong> – (string) The hyper-parameters used to build the network.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel.build">
<em class="property">abstract </em><code class="sig-name descname">build</code><span class="sig-paren">(</span><em class="sig-param">input_list</em>, <em class="sig-param">noisy_params=None</em>, <em class="sig-param">noise_rate=0.05</em>, <em class="sig-param">is_training=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel.build" title="Permalink to this definition">¶</a></dt>
<dd><p>Create the model</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>input_list</strong> – (list&lt;tf.tensor&gt;) A list of tensors containing the features
for a list of documents.</p></li>
<li><p><strong>noisy_params</strong> – (dict&lt;parameter_name, tf.variable&gt;) A dictionary of noisy parameters to add.</p></li>
<li><p><strong>noise_rate</strong> – (float) A value specify how much noise to add.</p></li>
<li><p><strong>is_training</strong> – (bool) A flag indicating whether the model is running in training mode.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of tf.Tensor containing the ranking scores for each instance in input_list.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel.get_variable">
<code class="sig-name descname">get_variable</code><span class="sig-paren">(</span><em class="sig-param">name</em>, <em class="sig-param">shape</em>, <em class="sig-param">noisy_params=None</em>, <em class="sig-param">noise_rate=0.05</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel.get_variable" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a tensorflow variable for the model. Add noise if required.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> – The name of the variable.</p></li>
<li><p><strong>shape</strong> – The shape of the variable.</p></li>
<li><p><strong>noisy_params</strong> – (dict&lt;parameter_name, tf.variable&gt;) A dictionary of noisy parameters to add.</p></li>
<li><p><strong>noise_rate</strong> – (float) A value specify how much noise to add.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A tf.Tensor</p>
</dd>
</dl>
</dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.BaseRankingModel.model_parameters">
<code class="sig-name descname">model_parameters</code><em class="property"> = {}</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.BaseRankingModel.model_parameters" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="ultra.ranking_model.base_ranking_model.Initializer">
<em class="property">class </em><code class="sig-prename descclassname">ultra.ranking_model.base_ranking_model.</code><code class="sig-name descname">Initializer</code><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.Initializer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Initializer key strings.</p>
<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.Initializer.CONSTANT">
<code class="sig-name descname">CONSTANT</code><em class="property"> = 'constant'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.Initializer.CONSTANT" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="ultra.ranking_model.base_ranking_model.NormalizationFunctions">
<em class="property">class </em><code class="sig-prename descclassname">ultra.ranking_model.base_ranking_model.</code><code class="sig-name descname">NormalizationFunctions</code><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.NormalizationFunctions" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Normalization Functions key strings.</p>
<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.NormalizationFunctions.BATCH">
<code class="sig-name descname">BATCH</code><em class="property"> = 'batch'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.NormalizationFunctions.BATCH" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="ultra.ranking_model.base_ranking_model.NormalizationFunctions.LAYER">
<code class="sig-name descname">LAYER</code><em class="property"> = 'layer'</em><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.NormalizationFunctions.LAYER" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="ultra.ranking_model.base_ranking_model.selu">
<code class="sig-prename descclassname">ultra.ranking_model.base_ranking_model.</code><code class="sig-name descname">selu</code><span class="sig-paren">(</span><em class="sig-param">x</em><span class="sig-paren">)</span><a class="headerlink" href="#ultra.ranking_model.base_ranking_model.selu" title="Permalink to this definition">¶</a></dt>
<dd><dl class="simple">
<dt>Create the scaled exponential linear unit (SELU) activation function. More information can be found in</dt><dd><p>Klambauer, G., Unterthiner, T., Mayr, A. and Hochreiter, S., 2017. Self-normalizing neural networks. In Advances in neural information processing systems (pp. 971-980).</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> – (tf.Tensor) A tensor containing a set of numbers</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The tf.Tensor produced by applying SELU on each element in x.</p>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="ultra-ranking-model-dnn-module">
<h2>ultra.ranking_model.dnn module<a class="headerlink" href="#ultra-ranking-model-dnn-module" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-ultra.ranking_model.linear">
<span id="ultra-ranking-model-linear-module"></span><h2>ultra.ranking_model.linear module<a class="headerlink" href="#module-ultra.ranking_model.linear" title="Permalink to this headline">¶</a></h2>
<p>Linear map: sum_i(args[i] * W[i]), where W[i] is a variable.</p>
<dl class="field-list simple">
<dt class="field-odd">param args</dt>
<dd class="field-odd"><p>a 2D Tensor or a list of 2D, batch, n, Tensors.</p>
</dd>
<dt class="field-even">param output_size</dt>
<dd class="field-even"><p>int, second dimension of W[i].</p>
</dd>
<dt class="field-odd">param bias</dt>
<dd class="field-odd"><p>boolean, whether to add a bias term or not.</p>
</dd>
<dt class="field-even">param bias_initializer</dt>
<dd class="field-even"><p>starting value to initialize the bias
(default is all zeros).</p>
</dd>
<dt class="field-odd">param kernel_initializer</dt>
<dd class="field-odd"><p>starting value to initialize the weight.</p>
</dd>
<dt class="field-even">returns</dt>
<dd class="field-even"><p>A 2D Tensor with shape <cite>[batch, output_size]</cite> equal to
sum_i(args[i] * W[i]), where W[i]s are newly created matrices.</p>
</dd>
<dt class="field-odd">raises ValueError</dt>
<dd class="field-odd"><p>if some of the arguments has unspecified or wrong shape.</p>
</dd>
</dl>
</div>
<div class="section" id="module-ultra.ranking_model">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-ultra.ranking_model" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="ultra.ranking_model.list_available">
<code class="sig-prename descclassname">ultra.ranking_model.</code><code class="sig-name descname">list_available</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#ultra.ranking_model.list_available" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></p>
</dd>
</dl>
</dd></dl>

</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="ultra.utils.html" class="btn btn-neutral float-right" title="ultra.utils package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="ultra.learning_algorithm.html" class="btn btn-neutral float-left" title="ultra.learning_algorithm package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2020, ULTRA

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>